package com.eckey.lab.controller;

import com.alibaba.fastjson.JSON;
import com.eckey.lab.entity.Product;
import com.eckey.lab.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/lists")
    public String lists() {
        List<Product> lists = productService.lists();
        return JSON.toJSONString(lists);
    }

}
